#!/usr/bin/env python

from tools import config

alert = False
min = config.getAlertMin ("uptime")
max = config.getAlertMax ("uptime")

def get () :
	""" """
	global alert
	try :
		f = open ("/proc/uptime")
		cont = f.read().split()
		f.close ()
	except :
		return "Cannot open file: /proc/uptime"
	val = int (float (cont[0])/3600)
	if val < min or val > max :
		alert = True
	else :
		alert = False
	return str (val)

def getAlert () :
	global alert
	return alert
